package cn.com.headfree.deptuser.dao.impl;

import cn.com.headfree.base.entity.TOuterDeptUser;
import cn.com.headfree.deptuser.dao.TOuterDeptUserDao;
import cn.com.headfree.vo.UserVo;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.*;

/**
 * Title:
 * Description:
 * Copyright: Copyright (c) 2017
 * Company: www.headfree.com.cn
 * @author fengya
 * @version 1.0
 * @date  2019年4月25日 上午9:03:47
 */
@Repository("tOuterDeptUserDao")
public class TOuterDeptUserDaoImpl extends BaseDaoImpl<TOuterDeptUser> implements TOuterDeptUserDao {


//	@Override
//	public List<UserVo> findDeptUserAll() {
//		String sql = "select du.id as id,user_id,dept_id,u.user_type,u.name as user_name from t_outer_dept_user du,t_outer_user u where du.user_id=u.id";
//		return this.findAllBySQL(UserVo.class, sql, null, false, null);
//	}

	@Override
	public List<UserVo> findDeptUserAll() {
		String sql = "select du.id as id,du.user_id,dept_id,u.user_type,u.name as user_name,d.erp_no " +
				" from t_outer_dept_user du " +
				" LEFT JOIN t_outer_user u on du.user_id=u.id " +
				" LEFT JOIN t_ding_user d on u.id = d.user_id";
		return this.findAllBySQL(UserVo.class, sql, null, false, null);
	}

	@Override
	public List<TOuterDeptUser> findAll() {
		String sql = "select * from t_outer_dept_user";
		return this.findAllBySQL(TOuterDeptUser.class, sql, null, false, null);
	}


}
